#include "plane.h"

void plane::draw()
{
	GLfloat nrmlcompon[4][3] = {{0.0, 1.0, 0.0},
								{0.0, 1.0, 0.0}, 
								{0.0, 1.0, 0.0},
								{0.0, 1.0, 0.0}};
	GLfloat ctrlpoints[4][3] = {{-0.5, 0,-0.5},
								{ 0.5, 0,-0.5},
								{-0.5, 0, 0.5},
								{ 0.5, 0, 0.5}};
	GLfloat textpoints[4][2] = {{ 0.0, 0.0},
								{ 0.0, 1.0}, 
								{ 1.0, 0.0},
								{ 1.0, 1.0}};
	glMap2f(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 2,  0.0, 1.0, 6, 2,  &ctrlpoints[0][0]);
	glMap2f(GL_MAP2_NORMAL,   0.0, 1.0, 3, 2,  0.0, 1.0, 6, 2,  &nrmlcompon[0][0]);
	glMap2f(GL_MAP2_TEXTURE_COORD_2,  0.0, 1.0, 2, 2,  0.0, 1.0, 4, 2,  &textpoints[0][0]);
	glEnable(GL_MAP2_VERTEX_3);
	glEnable(GL_MAP2_NORMAL);
	glEnable(GL_MAP2_TEXTURE_COORD_2);
	glShadeModel(GL_SMOOTH);					
	glEnable(GL_TEXTURE_2D);
	glMapGrid2f(50, 0,1, 50, 0.0,1); 
	glEvalMesh2(GL_FILL, 0,50, 0,50);
}